<template>
  <div class="wrapper">
    <div>
      <!-- 音乐的标题 -->
      <div class="title_box">
        <h1 class="name">{{ $store.state.musis_info.name }}</h1>
        <div class="man_name">
          {{ $store.state.musis_info.song.artists[0].name }}
        </div>
        <div class="dsj">{{ $store.state.musis_info.song.alias[0] }}</div>
      </div>
      <!-- 音乐的图片和歌词 -->
      <div class="img_friends_box">
        <div class="img">
          <div
            class="big_box big_box_animal"
            :style="
              !$store.state.paly_icon
                ? 'animation-play-state:paused'
                : 'animation-play-state:running'
            "
          >
            <div class="sm_box">
              <div class="sm_box_img">
                <img :src="$store.state.musis_info.picUrl" alt="" />
              </div>
            </div>
          </div>
        </div>
        <div class="friens_box">
          <div class="friens" ref="lyric_box">
            <div
              class="gc"
              v-for="(item, index) in $store.state.lyric"
              :key="index"
              :data-index="index"
              ref="gc"
              :class="index === $store.state.lyric_active_index ? 'active' : ''"
              @click="aa()"
            >
              {{ item.str }}
            </div>
          </div>
        </div>
      </div>

      <!-- 评论条数   跟   点击写评论 -->
      <div>
        <!-- <div class="all_comment_count">全部评论(13123)</div>
        <div class="write_comment">写评论</div> -->
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "Lyrics",
  data() {
    return {
      lyric: [],
    };
  },
  created() {
    console.log(this);
  },
  mounted() {
    this.$store.commit("lyric_box", this.$refs.lyric_box);
    this.$store.commit("gc", this.$refs.gc);
  },
  beforeRouteLeave(to, from, next) {
    this.$store.commit("lyric_box", "");
    this.$store.commit("gc", "");
    next();
  },
  methods: {
    aa() {
      console.log(this);
    },
  },
};
</script>

<style lang="less" scoped>
.title_box {
  text-align: center;
  color: #333;
  .man_name {
    color: #666;
  }
}
.img_friends_box {
  display: flex;
  //   background: chocolate;
  height: 450px;
  .img {
    flex: 50%;
    // background: cornflowerblue;
    display: flex;
    justify-content: center;
    align-items: center;
    .big_box {
      width: 350px;
      height: 350px;
      background: #ccc;
      border-radius: 50%;
      display: flex;
      justify-content: center;
      align-items: center;
      .sm_box {
        width: 320px;
        height: 320px;
        background: black;
        border-radius: 50%;
        display: flex;
        justify-content: center;
        align-items: center;
        .sm_box_img {
          width: 240px;
          height: 240px;
          background: blue;
          border-radius: 50%;
          display: flex;
          justify-content: center;
          align-items: center;
          img {
            width: 100%;
            height: 100%;
            border-radius: 50%;
          }
        }
      }
    }
    @keyframes music {
      from {
        transform: rotate(0deg);
      }
      to {
        transform: rotate(360deg);
      }
    }
    .big_box_animal {
      animation-name: music;
      animation-duration: 20s;
      animation-iteration-count: infinite;
      animation-timing-function: linear;
    }
  }

  .friens_box {
    // background: springgreen;
    flex: 50%;
    height: 450px;
    overflow: hidden;
    .friens {
      text-align: center;
      transition: transform 0.5s;
      // transform: translateY(20px);
      .gc {
        margin-top: 20px;
        cursor: pointer;
      }
      .active {
        font-size: 20px;
        font-weight: bold;
        color: skyblue;
      }
    }
  }
}
.all_comment_count {
  margin-bottom: 20px;
}
.write_comment {
  cursor: pointer;
  display: inline-block;
}
</style>